var util = require('../../../utils/util.js');
var ajax = require('../../../utils/ajax.js');
var common = require('../../../utils/common.js');
var PageBase = require('../../../common/PageBase.js');
var app = getApp();

Page(common.extendPage(PageBase, {
  data: {
    dataLoaded: false
  },

  onLoad() {
    var eid = app.getEmployeeid();
    var esid = app.getEmployeeSid();
    this._getQRcode(eid,esid);
  },

  _getQRcode(eid, esid){
    var url = 'm=index&c=common&a=qrcode';
    var scene = esid + ',' + eid;
    var data ={
      path: "pages/shop/home/index",
      scene
      }
    ajax.G({
      url,
      data,
      success: (data) => {
          //debugger;
          if(data.code == 1){
            this.setData({
              dataLoaded: true
            });
            util.showWarn(data.msg);
            return
          }
          this.setData({
             qrcode: data.data.url,
             dataLoaded: true
          })
      },
      fail: (data) => {
     
      }
    })

  }



}));